<template>
  <div class="wxLoading">
    <div class="content">
      <div
        v-for="n of 12"
        class="animationCircle"
        :style="{
          transform: `rotate(${30 * n}deg)`,
        }"
      >
        <span
          class="circleLine"
          :style="{animationDelay: `${-.083 * n}s`}"
        />
      </div>

      <p v-if="desc" class="desc">{{desc}}</p>
    </div>
  </div>
</template>

<script>
  export default {
    props: {
      desc: {
        type: String
      }
    }
  }
</script>

<style lang='less' scoped>
  .wxLoading {
    z-index: 99;

    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
  }

  .content {
    position: absolute;
    left: 50%;
    top: 50%;

    margin-top: -20px;
    border-radius: 5px;
    padding: 100px 5px 20px;
    min-width: 110px;

    text-align: center;

    color: #fff;
    background-color: rgba(30, 30, 30, .9);
    transform: translate(-50%, -50%);
  }

  .animationCircle {
    position: absolute;
    left: 50%;
    top: 31px;

    width: 2px;
    height: 27px;

    font-size: 0;

    transform-origin: 50% 100%;
  }

  @keyframes opacityAnimation {
    from {
      opacity: 1;
    }
    to {
      opacity: .3;
    }
  }

  .circleLine {
    display: inline-block;

    width: 100%;
    height: 13px;

    background-color: #fff;

    animation: opacityAnimation linear 1s infinite;
  }
</style>
